package com.dao.impl;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.Timestamp;
import java.util.Date;

import com.bo.BusinessUserInfo;
import com.bo.Order;
import com.dao.BusinessUserInfoDao;
import com.db.util.DBUtil;

public class BusinessUserInfoDaoImpl implements BusinessUserInfoDao{
	public BusinessUserInfo insert(BusinessUserInfo buInfo) throws Exception{
		String insertInto = "insert into t_business_user_info(user_id, company_name) values(?,?)";
		Connection conn = DBUtil.getConnection();
		PreparedStatement ps = null;
		try {
			int i=0;
			ps = conn.prepareStatement(insertInto);
			ps.setLong(++i, buInfo.getUserId());
			ps.setString(++i, buInfo.getCompanyName());
			ps.execute();
			buInfo.setId(DBUtil.getLastInsertId(conn));
		} catch (Exception e) {
			throw e;
		} finally {
			DBUtil.closeAll(null, ps, conn);
		}
		return buInfo;
	}
}
